<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>系统登录</title>
<script type="text/javascript">

	function check(){
		var flag=true;
		var username=document.getElementById("username").value;
		var password=document.getElementById("password").value;
		var password2=document.getElementById("password2").value;
		var loginInfo2=document.getElementById("loginInfo2");		
		
		if(username.length==0 || username==null){
			loginInfo2.innerText="用户名不能为空！";
			flag=false;
		}
		
		if(password.length==0 || password2.length==0){
			loginInfo2.innerText="密码不能为空！";
			flag=false;
		}
		
		if(password!=password2){
			loginInfo2.innerText="两次密码必须一致！";
			flag=false;
		}
		
		return flag;		
	}
	

</script>
</head>
<body>
	<%
		String regInfo = (String) request.getAttribute("regInfo");
	%>
	<h3 align="center">用户注册</h3>
	<form action="user" method="post" onsubmit="return check();">
		<input type="hidden" name="type" value="reg">
		<table align="center" border="1">
			<tr>
				<td>用户名：</td>
				<td><input type="text" id="username" name="username" /></td>
			</tr>
			<tr>
				<td>密码:</td>
				<td><input type="password" id="password" name="password" /></td>
			</tr>
			<tr>
				<td>确认密码:</td>
				<td><input type="password" id="password2" name="password2" /></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><input type="submit" value="注册" />
				</td>
			</tr>
		</table>
		<%
			if (regInfo != null) {
		%>
		<h5 align="center" id="loginInfo"><%=regInfo%></h5>
		<%
			}
		%>
		<h5 align="center" id="loginInfo2"></h5>
	</form>
</body>
</html>